<?php
class Reale_Model_Estate_Property extends Reale_Model_Estate_Generic
{
	/**
	 * 
	 * Stores property's owner
	 * @var string
	 */
	protected $_owner;
	
	/**
	 * 
	 * Stores property's owner contact number
	 * @var string
	 */
	protected $_owner_contact_no;
	
	/**
	 * 
	 * Stores property's owner address
	 * @var string
	 */
	protected $_owner_address;
	
	
	/**
	 * 
	 * Stores enquiry entity mapper
	 * @var Reale_Model_EnquiryMapper
	 * 
	 */
	protected $_mapper;
	
	
	/**
	 * 
	 * Setter function for data member owner 
	 * @param string owner
	 */
	public function setOwner($owner) {
		$this->_owner = $owner;
		return $this;
	}
	
	/**
	 * 
	 * Getter function for data member owner
	 * @return string $_owner
	 */
	public function getOwner() {
		return $this->_owner;	
	}
	
	/**
	 * 
	 * Setter function for data member owner contact number 
	 * @param string owner_contact_no
	 */
	public function setOwner_contact_no($owner_contact_no) {
		$this->_owner_contact_no = $owner_contact_no;
		return $this;
	}
	
	/**
	 * 
	 * Getter function for data member owner contact no
	 * @return string $_owner_contact_no
	 */
	public function getOwner_contact_no() {
		return $this->_owner_contact_no;	
	}
	
	/**
	 * 
	 * Setter function for data member owner adress 
	 * @param string owner_address
	 */
	public function setOwner_address($owner_address) {
		$this->_owner_address = $owner_address;
		return $this;
	}
	
	/**
	 * 
	 * Getter function for data member owner address
	 * @return string $_owner_address
	 */
	public function getOwner_address() {
		return $this->_owner_address;	
	}
	
	/**
	 * 
	 * Setter function for property mapper 
	 * @param Reale_Model_PropertyMapper
	 */
	public function setMapper($mapper) {
		$this->_mapper = $mapper;
		return $this;
	}
	
	/**
	 * 
	 * Getter function for property mapper
	 * @return Reale_Model_Estate_PropertyMapper $_mapper
	 */
	public function getMapper(){
        if (null === $this->_mapper) {
            $this->setMapper(new Reale_Model_Estate_PropertyMapper());
        }
        return $this->_mapper;
    }
  
    /**
     * 
     * To save new or update existing property's informtion.
     * return Reale_Model_Estate_Property | null
     * 
     */
    public function save() {
    	$return = $this->getMapper()->save($this);
    	if ($return) {
    	    /* I think not need as mapper accepts &$this
        	if ($return instanceof Reale_Model_Estate_Property) {
        		$this->setEstate_id($return->getEstate_id());
        	}*/
        	return true;
    	}
    	return null;
    } 
	
}

